#include "Frame/video.hpp"

video::video(Process *_process):Frame(_process)
{
}

video::~video()
{
	delete io;
}

int video::Work()
{
	for (;;)
	{
		this->DoEvents(10);
		if(!state->RunningFlag)
			break;
		
		if (!state->PausingFlag)
		{
			if(!nextFrame())
				break;
			process->m_count++;
			process->AddFrameFlag = true;
			
			process->Do(this->model->src_img);
			Notify(this->model->Result());
			Log(this->model->GetInfo());
		}
	}
	return -1;
}

int video::nextFrame()
{
	if(this->io->GetImage(this->model->src_img))
	{
		this->model->AddFrame();
		return 1;
	}
	return 0;
}
